<template>
  <div class="home-header">
    <div class="date-box">
      <div class="date-days">{{ days }}</div>
      <div class="date-month">{{ month }}</div>
    </div>
    <h1>知乎日报</h1>
    <van-image class="avatar" round width="1rem" height="1rem" src="https://img.yzcdn.cn/vant/cat.jpeg" />
  </div>
</template>

<script>
const monthMapZh = ['一月', '二月', '三月', '四月', '无月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
export default {
  name: 'HomeHeader',
  data() {
    return {
      days: 30,
      month: ''
    }
  },
  created() {
    const now = new Date()
    this.days = now.getDate()
    this.month = monthMapZh[now.getMonth()]
  }
}
</script>

<style lang="less" scoped>
.home-header {
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #fff;
  .date-box {
    position: relative;
    padding: 0 10px;
    .date-days {
      font-size: 16px;
      color: #333;
      font-weight: 700;
      text-align: center;
    }
    .date-month {
      font-size: 12px;
      color: #333;
      text-align: center;
    }
  }
  .date-box:after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    height: 100%;
    background-color: #c0c0c0;
    -webkit-transform: scaleX(0.5);
    transform: scaleX(0.5);
  }
  h1 {
    flex: 1;
    padding: 0 10px;
    font-size: 22px;
  }
  .avatar {
    padding: 0 10px;
  }
}
</style>
